<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>check.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  
  <body>
  	您的爱好很广泛!!!
  	 <br>
	 <input type="checkbox" name="checkItems" value="全选/全不选"/>全选/全不选
	 <br>
        <input type="checkbox" name="items" value="足球" />足球
		<input type="checkbox" name="items" value="篮球"/>篮球
		<input type="checkbox" name="items" value="游泳"/>游泳
		<input type="checkbox" name="items" value="唱歌"/>唱歌
		<br>
		<input type="button" name="checkall" id="checkall" value="全选" />
		<input type="button" name="checkall" id="checkallNo" value="全不选" />
		<input type="button" name="checkall" id="check_revsern" value="反选" />
  </body>
  <script language="JavaScript">
        var items = document.getElementsByName("items");
        document.getElementById("checkall").onclick = function(){
            for(var i  = 0 ;i<items.length;i++){
                items[i].checked = true;
            }
        }

        document.getElementById("checkallNo").onclick = function(){
            for(var i  = 0 ;i<items.length;i++){
                items[i].checked = false;
            }
        }

        document.getElementById("check_revsern").onclick = function(){
            for(var i  = 0 ;i<items.length;i++){
               if(items[i].checked==false){
                   items[i].checked = true;

               }else {
                   items[i].checked = false;
               }
            }
        }
        document.getElementsByName("checkItems")[0].onclick=function() {
            var items = document.getElementsByName("items");
            for(var i = 0;i<items.length;i++){
                items[i].checked = this.checked;
            }
        }

  </script>
</html>
